package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.SyllabusQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.SyllabusDao;
import com.bbdjt.weixin.model.Syllabus;
import com.bbdjt.weixin.service.SyllabusService;

@Service("syllabusService")
public class SyllabusServiceImpl extends BaseServiceImpl<Syllabus> implements SyllabusService {
	
	@Override
    public List<Syllabus> selectBySyllabus(Syllabus syllabus, int page, int rows) {
        Example example = new Example(Syllabus.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(syllabus);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Syllabus> selectBySyllabus(Syllabus syllabus) {
        Example example = new Example(Syllabus.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(syllabus);
        return selectByExample(example);
    }

    @Override
    public PageInfo<SyllabusQueryModel> selectBySyllabusQueryModel(SyllabusQueryModel syllabus) {
    	return ((SyllabusDao) getMapper()).selectBySyllabusModel(syllabus);
    }

	@Override
	public List<Syllabus> selectBySyllabus(SyllabusQueryModel syllabus) {
		  Example example = new Example(Syllabus.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(syllabus);
	        PageHelper.startPage(syllabus.getPageNum(), syllabus.getPageSize(),syllabus.getOrderBy());
	        return selectByExample(example);
	}

	@Override
	public List<Syllabus> selectSyllabusList(Syllabus syllabus) {
		return ((SyllabusDao) getMapper()).selectSyllabusList(syllabus);
	}

	@Override
	public List<Syllabus> doctorSelectSyllabs(Syllabus syllabus) {
		return ((SyllabusDao) getMapper()).doctorSelectSyllabs(syllabus);
	}

	@Override
	public Syllabus selectSyllabus(Syllabus syllabus) {
		return ((SyllabusDao) getMapper()).selectSyllabus(syllabus);
	}

	@Override
	public List<Syllabus> selectStartSyllabus(Syllabus syllabus) {
		return ((SyllabusDao) getMapper()).selectStartSyllabus(syllabus);
	}

}